/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.util.Date;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class ShowStatisticsCustomerNum extends AbstractAction
/*    */ {
/*    */   public ShowStatisticsCustomerNum(AbstractHttpServlet servlet)
/*    */   {
/* 23 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 29 */     User user = super.getLoginUser(request);
/* 30 */     CustomerManager manager = new CustomerManager();
/*    */ 
/* 32 */     Date start = Util.str2Date(request.getParameter("start"));
/* 33 */     Date end = Util.str2Date(request.getParameter("end"));
/* 34 */     int type = Util.str2Int(request.getParameter("type"));
/* 35 */     String userId = Util.getURLParameter(request.getParameter("userId"));
/*    */ 
/* 37 */     if ((!user.isAdmin) && (!user.isGroupAdmin))
/*    */     {
/* 39 */       userId = user.userId;
/* 40 */     } else if (user.isGroupAdmin)
/*    */     {
/* 42 */       if (super.getUserGroupId(user.companyId, userId) != user.groupId) {
/* 43 */         userId = user.userId;
/*    */       }
/*    */     }
/*    */ 
/* 47 */     int needNum = manager.getNeedContactCustomerNum(userId, type, start, 
/* 48 */       end);
/* 49 */     int contactedNum = manager.getContactedCustomerNum(userId, type, start, 
/* 50 */       end);
/*    */ 
/* 52 */     response.setContentType("text/html;charset=utf-8");
/* 53 */     PrintWriter out = response.getWriter();
/* 54 */     JSONObject jsonObject = new JSONObject();
/* 55 */     jsonObject.put("error", "0");
/* 56 */     jsonObject.put("need", Integer.valueOf(needNum));
/* 57 */     jsonObject.put("contacted", Integer.valueOf(contactedNum));
/* 58 */     out.println(jsonObject);
/* 59 */     out.flush();
/* 60 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ShowStatisticsCustomerNum
 * JD-Core Version:    0.6.1
 */